# -*- coding: utf-8 -*-
import tornado.web

class HoroscopeHandler(tornado.web.RequestHandler):
    def get(self):
        self.render('20150701biyeji/horoscope.html')

CITY_MAP = {
    1: '桂林',
    2: '青岛',
    3: '长沙',
    4: '澳门',
    5: '周庄',
    6: '哈尔滨',
    7: '天津',
    8: '鼓浪屿',
    9: '长白山',
    10: '九寨沟',
    11: '宜兴',
    12: '三亚',
    13: '北戴河',
    14: '大理',
    15: '北京',
    16: '拉萨',
    17: '荔波',
    18: '北海',
}

MOOD_MAP = {
    "anlian": "哎呦我去，原来我在%s表白能追到TA啊",
    "wending": "还没到七年就痒了，我决定带TA去%s挠一挠",
    "relian": "谁也别拦我和TA去%s，到时候别怪我刷屏秀恩爱虐狗",
    "jiujie": "从%s回来我就坚定信念，还是和你凑合凑合吧，未来的说不定更丑",
}

class HoResultHander(tornado.web.RequestHandler):
    def get(self, city_id, mood):
        if int(city_id) > 18 or mood not in ["anlian", 'wending', 'relian', 'jiujie']:
            raise tornado.web.HTTPError(503)

        self.render('20150701biyeji/result.html', city_id=city_id, mood=mood,
                    mood_name=(MOOD_MAP[mood] % CITY_MAP.get(int(city_id), "")))

